package tests;

import java.util.ArrayList;

import engine.LeitorDeEngines;
import gui.Facade;
import junit.framework.TestCase;

public class ProcuraTudoTest extends TestCase {
	private Facade facade;
	private final String Link1 = "http://www.stj.jus.br/SCON/jurisprudencia/toc.jsp?tipo_visualizacao=RESUMO&b=ACOR&livre=(Primeira+Turma).org.+bebida&data=%40DTDE+%3e%3D+19700101+e+%40DTDE+%3c%3D+20090101";
	private final String Link2 = "http://www.stf.jus.br/portal/jurisprudencia/listarJurisprudencia.asp?base=baseAcordaos&s1=+bebida+(@JULG%20%3e=%2019700101)(@JULG%20%3c=%2020090101)";
	private final String Link3 = "http://www.lexml.gov.br/busca/search?f1-tipoDocumento=Legisla%C3%A7%C3%A3o&keyword=bebida&localidade=Brasil&apelido=lei+seca";
	protected void setUp() { 
		facade = Facade.getInstance();
	} 


	public void testGeracaoDeLinks() {
		ArrayList<String> links;
		links = facade.pesquisa("bebida", null, "19700101", "20090101", null, "Primeira Turma", 
											 null, "Brasil", null, "lei seca", true, true);

		assertEquals("ERRO: Busca Tudo", Link1, links.get(0));
		assertEquals("ERRO: Busca Tudo", Link2, links.get(1));
		assertEquals("ERRO: Busca Tudo", Link3, links.get(2));

	}
	
	public void testTamanhoDoArrayDeLinks() {
		ArrayList<String> links;
		links = facade.pesquisa("bebida", null, "19700101", "20090101", null, "Primeira Turma", 
				 null, "Brasil", null, "lei seca", true, true);
		assertEquals("ERRO: Busca Tudo", 3, links.size());
	}
}
